/*
*	create by  jack ,20210706
*	
*	描述 ：
*   修改记录：[内容][作者][时间]
*	
*/

#ifndef _GPRS_MODULES_H_
#define _GPRS_MODULES_H_

#include "define_comm.h"
#include "task_manager.h"


typedef enum
{
	GPRS_CMD_NONE,
	GPRS_CMD_SET_ATE0,
	GPRS_CMD_GET_ICCID,
	GPRS_CMD_GET_IMEI,
	GPRS_CMD_GET_CSQ,
	GPRS_CMD_SET_CSGP,
	//"中国联通，场景ID 1, IPv4"
	GPRS_CMD_SET_CSGP_DEFAULT,
	GPRS_CMD_SOCKET_OPEN,
	GPRS_CMD_SOCKET_SEND_DATA,
	GPRS_CMD_SOCKET_CLOSE,
	GPRS_CMD_SOCKET_STATE,
}gprs_cmd;

typedef enum
{
	GPRS_LINK_NONE,
	GPRS_LINK_OPENING,
	GPRS_LINK_CONNECT,
	GPRS_LINK_LISTENING,
	GPRS_LINK_CLOSING,
}gprs_link_state;

typedef struct 
{
	sj_int8 context_id;//<1-16>
	sj_int8 connect_type;//<IPv4 IPv6 IPv4v6>	
	sj_char *apn;//"UNINET":中国联通
}gprs_csgp_data;

typedef struct
{
	sj_char *data;
	sj_int32 lenght;
}gprs_send_data;

typedef union
{
	gprs_csgp_data gsgp;
	gprs_send_data data;
}gprs_cmd_data;

typedef struct
{
	sj_int8 context_id;
	sj_int8 connect_id;
	sj_int8 access_mode;
	sj_char *service_type;
	sj_char *ip_addr;
	sj_int32 remote_port;
	sj_int32 local_port;
	sj_int8 link_state;	
}gprs_link_handle;


sj_int8 gprs_get_net_state(sj_int8 *state);

sj_int8 gprs_sync_send_cmd(gprs_link_handle *handle,sj_int8 cmd,gprs_cmd_data *data,sj_int32 timeout);

sj_int8 gprs_async_send_cmd(gprs_link_handle *handle,sj_int8 cmd);

sj_task_t *get_gprs_read_task_handle(sj_void);

sj_task_t *get_gprs_task_handle(sj_void);

#endif